#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
int addDigits(int num) {
	//return (num - 1) % 9 + 1;
	int temp = num;
	int sum = 0;
	while (temp >= 10)
	{
		sum = 0;
		while (temp>0)
		{
			sum += temp % 10;
			temp /= 10;
		}
		temp = sum;
	}
	return sum;
}
int main()
{
	cout << (addDigits(38) == 2 ? 1: 0 )<< endl;
}